/**
 * \file UnitSelectionWidget.h
 * \brief Header file for \a UnitSelectionWidget class.
 * \ingroup Gui
 */

#ifndef UNITSELECTIONWIDGET_H
#define UNITSELECTIONWIDGET_H

#include<QComboBox>
#include<QHBoxLayout>
#include<QPushButton>
#include<QWidget>

#include"Unit.h"

class Map;

/**
 * \class UnitSelectionWidget
 * \brief Widget used to specify and later construct one particular \a Unit.
 * \ingroup Gui
 */

class UnitSelectionWidget: public QWidget{
Q_OBJECT
public:
	UnitSelectionWidget(QWidget *parent);///<Constructor. \param parent Parent widget.
	~UnitSelectionWidget();///<Destructor.
	
	Unit *getUnit(Map *map, Team team)const;///<Builds one \a Unit. \param map The \a Map for this \a Unit. \param team The \a Team for this \a Unit.
	
	UnitAge age()const;///<Returns the \a UnitAge currently selected.
	UnitType type()const;///<Returns the \a UnitType currently selected.
	
	void setAge(UnitAge age);///<Sets the current \a UnitAge. \param age The \a UnitAge to set.
	void setType(UnitType type);///<Sets the current \a UnitType. \param type The \a UnitType to set.
signals:
	void deleteThis();///<Emitted when this widget should be deleted.
private slots:
	void slotDeleteThis();///<Called when this widget wants to be deleted.
	void slotAgeIndexChanged(int age);///<Called when the \a UnitAge selection changed. \param age The \a UnitAge currently selected.
private:
	QHBoxLayout *m_layout;///<Gui stuff.
	QComboBox *m_ageSelection;///<Gui stuff.
	QComboBox *m_unitSelection;///<Gui stuff.
	QPushButton *m_deleteButton;///<Gui stuff.
	
	QStringList unitsForAge(UnitAge age);///<Returns a list of names for the \a Unit s of this \a UnitAge. \param age The \a UnitAge for which the names are requested.
};

#endif
